//uniform mat4	MV;
uniform mat4	M;
varying vec2	vPos;
varying vec3	lPos;

#ifdef EMISSIVE
uniform mat4	VP;
varying	vec2	vPPos;
varying	vec2	lPPos;
#endif

void main()
{
	vec4 pos;

	pos = gl_ModelViewProjectionMatrix * gl_Vertex;
	gl_Position = pos;
#ifdef EMISSIVE
	vPPos = pos.xy / pos.w;
#endif

	vPos = pos.xy / pos.w;
	vPos *= 0.5;
	vPos += 0.5;

	//pos = MV * vec4( 0, 0, 0, 1 );
	pos = M * vec4( 0, 0, 0, 1 );
	lPos = pos.xyz / pos.w;

#ifdef EMISSIVE
	pos = VP * pos;
	lPPos = pos.xy / pos.w;
#endif
}